package org.skatiger.jrove.spring.tags.component;

import org.springframework.context.MessageSource;
import org.springframework.context.NoSuchMessageException;

public class Theme extends Message {
    /**
     * Use the theme MessageSource for theme message resolution.
     */
    @Override
    protected MessageSource getMessageSource() {
        return getRequestContext().getTheme().getMessageSource();
    }

    /**
     * Return exception message that indicates the current theme.
     */
    @Override
    protected String getNoSuchMessageExceptionDescription(
            NoSuchMessageException ex) {
        return "Theme '" + getRequestContext().getTheme().getName() + "': "
                + ex.getMessage();
    }
}
